<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/tld/Paging.tld" prefix="pagingTag"%>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
<head>
<title>Xem log jsoup</title>
</head>
<body>
	<section class="database">
		<article>
			Hiển thị : <select class="showRow" style="margin-right: 50px;">
				<option value="${sizePerPage}" selected="selected">${sizePerPage}</option>
				<option value="10">10</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			Sắp theo : <select class="sortBy" style="margin-right: 50px;">
				<option value="dateLog" <c:if test="${sortBy=='dateLog'}">selected="selected"</c:if>>Ngày</option>
				<option value="isError" <c:if test="${sortBy=='isError'}">selected="selected"</c:if>>Trạng thái</option>
			</select>
			Loại log : <select class="typeLog" style="margin-right: 50px;">
				<option value="jsoup blogtruyen" <c:if test="${typeLog=='jsoup blogtruyen'}">selected="selected"</c:if>>Jsoup blogtruyen</option>
				<option value="jsoup truyen hixxinfo" <c:if test="${typeLog=='jsoup truyen hixxinfo'}">selected="selected"</c:if>>Jsoup hixxinfo</option>
				<option value="jsoup thegioima" <c:if test="${typeLog=='jsoup thegioima'}">selected="selected"</c:if>>Jsoup thegioima</option>
				<option value="jsoup anh dep" <c:if test="${typeLog=='jsoup anh dep'}">selected="selected"</c:if>>Jsoup ảnh đẹp</option>
			</select>
			<select class="sort">
				<option value="asc" <c:if test="${sort=='asc'}">selected="selected"</c:if>>Tăng dần</option>
				<option value="desc" <c:if test="${sort=='desc'}">selected="selected"</c:if>>Giảm dần</option>
			</select>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='<spring:url value="/quan-ly/log/xoa-log-jsoup.htm?isError=false" />'>Xóa log OK</a>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='<spring:url value="/quan-ly/log/xoa-log-jsoup.htm?isError=true" />'>Xóa log ERROR</a>
			<script type="text/javascript">
					$(function() {
						$(".sortBy").change(function() {
							var curPage = 1;
							var sizePerPage = $(".showRow").val();
							var sort = $(".sort").val();
							var sortBy = $(".sortBy").val();
							var typeLog = $(".typeLog").val();
							$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
						});
						$(".showRow").change(function() {
							var curPage = 1;
							var sizePerPage = $(".showRow").val();
							var sort = $(".sort").val();
							var sortBy = $(".sortBy").val();
							var typeLog = $(".typeLog").val();
							$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
						});
						$(".sort").change(function() {
							var curPage = ${curPage};
							var sizePerPage = $(".showRow").val();
							var sort = $(".sort").val();
							var sortBy = $(".sortBy").val();
							var typeLog = $(".typeLog").val();
							$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
						});
						$(".typeLog").change(function() {
							var curPage = ${curPage};
							var sizePerPage = $(".showRow").val();
							var sort = $(".sort").val();
							var sortBy = $(".sortBy").val();
							var typeLog = $(".typeLog").val();
							$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
						});
					});
			</script>
			<c:choose>
				<c:when test="${lstLogJsoup.size() > 0}">
						<h4 class="pInfo">Tổng số record : <font color="blue">${totalSize}</font></h4>
						<br class='clr' />
						<c:if test="${pInfo.totalPage > 1}">
							<section class="pInfo">
								<pagingTag:paging searchUrl="" curPageParam="curPage"
									searchValueParam="searchValue" pagingInf="${pInfo}"></pagingTag:paging>
							</section>
							<script type="text/javascript">
								$(function() {
									$(".bPage").click(function() {
										var curPage = $(this).val();
										var sizePerPage = $(".showRow").val();
										var sort = $(".sort").val();
										var sortBy = $(".sortBy").val();
										var typeLog = $(".typeLog").val();
										$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
									});
								});
							</script>
						</c:if>
						<br class='clr' />
						<table class="tableCss">
							<thead>
								<tr>
									<th>Tiêu đề</th>
									<th>Nội dung</th>
									<th>Ngày</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${lstLogJsoup}" var="item">
									<tr>
										<th>${item.name}</th>
										<th>${item.content}</th>
										<th><fmt:formatDate pattern="hh:mm dd/MM/yyyy" value="${item.dateLog}" /></th>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<c:if test="${pInfo.totalPage > 1}">
							<section class="pInfo">
								<pagingTag:paging searchUrl="" curPageParam="curPage"
									searchValueParam="searchValue" pagingInf="${pInfo}"></pagingTag:paging>
							</section>
							<script type="text/javascript">
								$(function() {
									$(".bPage").click(function() {
										var curPage = $(this).val();
										var sizePerPage = $(".showRow").val();
										var sort = $(".sort").val();
										var sortBy = $(".sortBy").val();
										var typeLog = $(".typeLog").val();
										$("body").load("<spring:url value='/quan-ly/log/xem-log-jsoup.htm' />",{curPage:curPage,sizePerPage:sizePerPage,sortBy:sortBy,sort:sort,typeLog:typeLog});
									});
								});
							</script>
						</c:if>
				</c:when>
				<c:otherwise>Chưa có dữ liệu...</c:otherwise>
			</c:choose>
		</article>
	</section>
</body>
